<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="/taglibs.jsp"%>
<%@page import="com.yaodian100.ec.campaign.entity.Campaign"%>
<script language="javascript">
	$().ready( function() {
		<c:if test="${campaign.range eq 'RedGreenCategory'}">
		$("#buyqry").html("合法购买组(红绿商品各1个为1组)");
		</c:if>
	});

</script>
<div class="f-link">
	<a href="search.do">回查询页</a>
	<yaodian100:checkPermission permissions="GROUP_A-50-100-300,ROLE_MM">
	<a href="edit.do">修改</a>
	<a href="clone.do">複製</a>
	<a href="javascript: if(confirm('确认删除?!')) {document.location='delete.do'}">删除</a></yaodian100:checkPermission>
</div>
<h1>行销活动管理</h1>
<table>
	<tr class="tb-data">
		<th>活动名称</th>
		<td>${campaign.campaignName}</td>
	</tr>
	<tr class="tb-data">
		<th>活动明細</th>
		<td>${campaign.campaignDesc}</td>
	</tr>
	<tr class="tb-data">
		<th>活动说明</th>
		<td>${campaign.campaignDetail}</td>
	</tr>
	<tr class="tb-data">
		<th>活动範圍</th>
		<td>${campaign.range.desc}
		
<c:if test="${campaign.range eq 'RedGreenCategory'}">
<br/><table><tr class="tb-data"><th>红标分类</th><th>绿标分类</th></tr>
<tr><td>
<s:iterator value="redRangeExtendObject" var="category">
${category.name}(${category.id}) (${category.categoryPath})<br/>
</s:iterator>
</td><td>
<s:iterator value="greenRangeExtendObject" var="category">
${category.name}(${category.id}) (${category.categoryPath})<br/>
</s:iterator>
</td></tr>
</table>
</c:if>

<c:if test="${campaign.range eq 'Category'}">
<br/>
<s:iterator value="rangeExtendObject" var="category">
${category.name}(${category.id}) (${category.categoryPath})<br/>
</s:iterator>
</c:if>

<c:if test="${campaign.range eq 'Product'}">
<br/>
<s:iterator value="campaign.rangeExtList" var="productId" status="index">
<c:if test="${index.index ne 0}">, </c:if>
${productId}
</s:iterator>
</c:if>
		</td>
	</tr>
	<tr class="tb-data">
		<th>活动类型</th>
		<td>${campaign.type.desc}</td>
	</tr>
<c:if test="${campaign.type != 'M02' && campaign.type != 'M03' && campaign.type != 'M04'}">
	<tr class="tb-data">
		<th><c:if test="${campaign.type == 'M01'}">发放计算基准<br/>(按订单金额)</c:if><c:if test="${campaign.type != 'M01'}">活动內容</c:if></th>
		<td>
<table width="600">
<c:choose>
<c:when test = "${campaign.type == 'M01'}">
<tr class="tb-data">
<th>S/N</th><th>订单金额</th><th>发放规则</th><th>封顶否？</th></tr>
<s:iterator value="campaign.typeExtends" var="extend" status="index">
<tr><td>${index.count} <!-- ${extend.uuid} --></td>
<td>${extend.minOrderAmount} ~ ${extend.maxOrderAmount}</td>
<td>每${extend.minQty}元, 发放 ${extend.maxQty}点积分</td>
<td>
<c-rt:if test="${extend.upperLimit}">是, (最多得${extend.bonusLimit}分)</c-rt:if>		
<c-rt:if test="${!extend.upperLimit}">否</c-rt:if>
</td>
</tr>
</s:iterator>
</c:when>
<c:otherwise>
<tr class="tb-data">
<th>S/N</th><th>订单金额</th><th id="buyqry">合法購買量</th><th>活動折減送</th></tr>
<s:iterator value="campaign.typeExtends" var="extend" status="index">
<tr><td>${index.count} <!-- ${extend.uuid} --></td>
<td>${extend.minOrderAmount} ~ ${extend.maxOrderAmount}</td><td>${extend.minQty} ~ ${extend.maxQty}</td>
<td>${campaign.type.desc}:
<c:if test="${campaign.type.code eq 'C03'}"><a target="_product" href="/ecadmin/product/edit.do?productId=${extend.campaignTypeExtension}">${extend.campaignTypeExtension}</a>
</c:if>
<c:if test="${campaign.type.code ne 'C03'}">${extend.campaignTypeExtension}</c:if>
</td></tr>
</s:iterator>
</c:otherwise>
</c:choose>
</table>
		</td>
	</tr>
</c:if>
	<c:if test="${campaign.type == 'M04'}">
	<tr class="tb-data">
		<th>前三名评论送积分</th>
		<td>${campaign.commentFirst3}点</td>
	</tr>
	<tr class="tb-data">
		<th>其他评论送积分</th>
		<td>${campaign.commentOthers}点</td>
	</tr>
	</c:if>
	<c:if test="${campaign.type == 'M01' || campaign.type == 'M04'}">
	<tr class="tb-data">
		<th>效期开始日</th>
		<td>为发放日${campaign.startPeriod}日 后开始可使用</td>
	</tr>
	<tr class="tb-data">
		<th>效期长度</th>
		<td>${campaign.periodDays}月</td>
	</tr>
	</c:if>
	<c:if test="${campaign.type == 'M02'}">
	<tr class="tb-data">
		<th>积分折抵比率</th>
		<td>积分 ${campaign.offsetRate} = 1元</td>
	</tr>
	<tr class="tb-data">
		<th>积分折抵上限</th>
		<td>订单金额${campaign.offsetUpperLimit}%</td>
	</tr>
	<tr class="tb-data">
		<th>积分折抵金额上限</th>
		<td>${campaign.offsetDiscountLimit}元</td>
	</tr>
	</c:if>
	<c:if test="${campaign.type == 'M03'}">
	<tr class="tb-data">
		<th>发送规则</th>
		<td>每日登入${campaign.loginCount}次，发送积分${campaign.giveBonus}点</td>
	</tr>
	</c:if>
	<tr class="tb-data">
		<th>活动日期时间</th>
		<td>
			<fmt:formatDate value="${campaign.startDateTime}" pattern="yyyy-MM-dd HH:mm"/> ~
			<fmt:formatDate value="${campaign.endDateTime}" pattern="yyyy-MM-dd HH:mm"/>
		</td>
	</tr>
	<tr class="tb-data">
		<th>活動渠道</th>
		<td>
<c:if test="${ignoreCookie}">全部渠道</c:if><c:if test="${! ignoreCookie}">
<c:forEach items="${campaign.cookieArray}" var="channel" varStatus="status">
<c:if test="${status.index!=0}">;</c:if>${menuChannel.options[channel].codeName}
</c:forEach></c:if>
		</td>
	</tr>
	<tr class="tb-data">
		<th>活動Domain</th>
		<td>${campaign.domain} / ${menuDomain.options[campaign.domain].name}</td>
	</tr>
	<tr class="tb-data">
		<th>启用</th>
		<td><c:if test="${campaign.enable}">是</c:if><c:if test="${!campaign.enable}">否</c:if></td>
	</tr>
	<tr class="tb-data">
		<th>预算归属</th>
		<td>${menuBudget.options[campaign.budget].name}</td>
	</tr>
	<tr class="tb-data">
		<th>备注</th>
		<td>${campaign.memo}</td>
	</tr>
	<tr class="tb-data">
		<th>修改备注</th>
		<td>
建立：<fmt:formatDate value="${campaign.createDate}" pattern="yyyy-MM-dd HH:mm"/> / ${campaign.createUser} <br/>
修改：<fmt:formatDate value="${campaign.modifyDate}" pattern="yyyy-MM-dd HH:mm"/> / ${campaign.modifyUser}
		</td>
	</tr>
</table>
<p></p>

<p></p>
<div class="f-link">
	<a href="search.do">回查询页</a>
	<yaodian100:checkPermission permissions="GROUP_A-50-100-300,ROLE_MM">
	<a href="edit.do">修改</a>
	<a href="clone.do">複製</a>
	<a href="javascript: if(confirm('确认删除?!')) {document.location='delete.do'}">删除</a></yaodian100:checkPermission>
</div>